package com.soats.demo8.controller;

import com.soats.demo8.Util.Result;
import com.soats.demo8.request.CrimeDataRequest;
import com.soats.demo8.service.apiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/crime")
public class apiController {

    @Autowired
    private apiService apiService;

    @GetMapping("/stat")
    private Result getRiskIndexCount(){
        return Result.suc(apiService.getRiskIndexCount());
    }

    @PostMapping
    private Result addCrimeData(@RequestBody CrimeDataRequest crimeDataRequest){
        return Result.suc(apiService.addCrimeData(crimeDataRequest));
    }
}
